import type { CaseReducer, PayloadAction } from '@reduxjs/toolkit'
import { createSlice } from '@reduxjs/toolkit'

type capacityManageStoreParams = {
  pageBtnAuthority?: object
  pageBtnAuthorityKeyArray?: { key: string; name: string }[]
  currCompanyCarGroupList?: Record<string, any>[]
  [key: string]: unknown
}

const capacityManageSlice = createSlice<
  capacityManageStoreParams,
  {
    updateCapacityManageStore: CaseReducer<
      capacityManageStoreParams,
      PayloadAction<capacityManageStoreParams | undefined>
    >
  },
  'capacityManageStore'
>({
  name: 'capacityManageStore',
  initialState: () => {
    return {
      xrToken: '' //星软token
    }
  },
  reducers: {
    updateCapacityManageStore: (state, { payload = {} }) => {
      // console.log("---capacityManageSlice--state---:", state)
      return {
        ...state,
        ...payload
      }
    }
  }
})
export { capacityManageSlice }
